<template>
  <div style="line-height: 1.8">
    <div>
      <h3>
        分类：{{ levelTypes }} <span class="ml50">题型：{{ questionTypes }}</span>
      </h3>
    </div>

    <div>
      <h3>题干：</h3>
    </div>
    <div v-if="question.type == '21'">
      <div class="q-title" v-html="question.title" />
      <h3>选项：</h3>
      <div class="q-content">
        <span :key="item.prefix" v-for="item in question.content" class="q-item-contain">
          <span class="q-item-prefix">{{ item.prefix }}</span>
          <span v-html="item.content" class="q-item-content"></span>
        </span>
      </div>
    </div>
    <div v-else-if="question.type == '22'">
      <div class="q-title" v-html="question.title" />
      <h3>选项：</h3>
      <div class="q-content">
        <span :key="item.id" v-for="item in question.content" class="q-item-contain">
          <span class="q-item-prefix">{{ item.prefix }}</span>
          <span v-html="item.content" class="q-item-content"></span>
        </span>
      </div>
    </div>
    <div v-else-if="question.type == '11'" class="flex">
      <div class="q-title" v-html="question.title" />
    </div>
    <div v-else-if="question.type == '31'">
      <div class="q-title" v-html="question.title" />
    </div>
    <div v-else-if="question.type == '32'">
      <div class="q-title" v-html="question.title" />
    </div>
    <div v-else></div>

    <div>
      <h3>答案：</h3>
      <div class="q-title" v-html="question.answer" v-if="question.type == '32'"></div>
      <div v-else>{{ question.answer }}</div>
    </div>

    <div>
      <h3>解析：</h3>
      <div class="q-title" v-html="question.analysis" />
    </div>

    <div>
      <h3>分数：</h3>
      <div>{{ question.score }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'QuestionShow',
  props: {
    question: {
      type: Object,
      default: function () {
        return {};
      },
    },
  },
  methods: {},
  computed: {
    levelTypes() {
      const level = this.website.knowledgeLevelLists.find(
        type => type.value == this.question.level
      );
      if (level) {
        return level.label;
      } else {
        return '';
      }
    },
    questionTypes() {
      const level = this.website.questionType.find(type => type.value == this.question.type);
      if (level) {
        return level.label;
      } else {
        return '';
      }
    },
  },
};
</script>
<style>

</style>
